﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DroidClaim.Web.Service;
using DroidClaim.Web.Models;
namespace DroidClaim.Web.Mapper
{
	public class ClaimInfoMapper
	{
		public static ClaimInfoModel DtoToModel(ClaimInfoDto inputDto) 
		{
			ClaimInfoModel result = new  ClaimInfoModel();

									result.Id = inputDto.Id;
											result.AccidentDate = inputDto.AccidentDate;
											result.AccidentLocation = inputDto.AccidentLocation;
											result.Latitude = inputDto.Latitude;
											result.Longitude = inputDto.Longitude;
											result.UpdateDate = inputDto.UpdateDate;
											result.AccImgPath = inputDto.AccImgPath;
											result.CliamDocImgPath = inputDto.CliamDocImgPath;
					 
						if(inputDto.ClaimStatus != null)
                          {
							result.ClaimStatus = inputDto.ClaimStatus.Id;
							result.ClaimStatusCode = inputDto.ClaimStatus.Code;
							result.ClaimStatusName = inputDto.ClaimStatus.Name;
						  }
					 
						if(inputDto.CliamDoc != null)
                          {
							result.CliamDoc = inputDto.CliamDoc.Id;
							result.CliamDocCode = inputDto.CliamDoc.Code;
							result.CliamDocName = inputDto.CliamDoc.Name;
						  }
					 
						if(inputDto.Customer != null)
                          {
							result.Customer = inputDto.Customer.Id;
							result.CustomerCode = inputDto.Customer.Code;
							result.CustomerName = inputDto.Customer.Name;
						  }
					 
						if(inputDto.Surveyor != null)
                          {
							result.Surveyor = inputDto.Surveyor.Id;
							result.SurveyorCode = inputDto.Surveyor.Code;
							result.SurveyorName = inputDto.Surveyor.Name;
						  }
											result.Code = inputDto.Code;
											result.Name = inputDto.Name;
					 
						if(inputDto.ClaimNumber != null)
                          {
							result.ClaimNumber = inputDto.ClaimNumber.Id;
							result.ClaimNumberCode = inputDto.ClaimNumber.Code;
							result.ClaimNumberName = inputDto.ClaimNumber.Name;
						  }
							
			return result;
		}

		    	
        public static ClaimInfoDto ModelToDto(ClaimInfoModel inputModel)
        { 
		
			ClaimInfoDto result = new  ClaimInfoDto
        
			{ 

									Id = inputModel.Id,
							
                
									AccidentDate = inputModel.AccidentDate,
							
                
									AccidentLocation = inputModel.AccidentLocation,
							
                
									Latitude = inputModel.Latitude,
							
                
									Longitude = inputModel.Longitude,
							
                
									UpdateDate = inputModel.UpdateDate,
							
                
									AccImgPath = inputModel.AccImgPath,
							
                
									CliamDocImgPath = inputModel.CliamDocImgPath,
							
                
										 ClaimStatus = new ClaimStatusDto() {Id = inputModel.ClaimStatus },
				   			
                
										 CliamDoc = new CliamDocDto() {Id = inputModel.CliamDoc },
				   			
                
										 Customer = new CustomerDto() {Id = inputModel.Customer },
				   			
                
										 Surveyor = new SurveyorDto() {Id = inputModel.Surveyor },
				   			
                
									Code = inputModel.Code,
							
                
									Name = inputModel.Name,
							
                
										 ClaimNumber = new ClaimNumberDto() {Id = inputModel.ClaimNumber },
				   			
                
				 };
            return result;
        }

	}
}